package com.ruoyi.system.service.impl;

import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WebUserShareMapper;
import com.ruoyi.system.domain.WebUserShare;
import com.ruoyi.system.service.IWebUserShareService;
import com.ruoyi.common.core.text.Convert;

/**
 * 客户分享Service业务层处理
 * 
 * @author wsliupan@126.com
 * @date 2021-07-02
 */
@Service
public class WebUserShareServiceImpl extends ServiceImpl<WebUserShareMapper, WebUserShare> implements IWebUserShareService
{
    @Autowired
    private WebUserShareMapper webUserShareMapper;

    /**
     * 查询客户分享
     * 
     * @param id 客户分享ID
     * @return 客户分享
     */
    @Override
    public WebUserShare selectWebUserShareById(Long id)
    {
        return webUserShareMapper.selectWebUserShareById(id);
    }

    /**
     * 查询客户分享列表
     * 
     * @param webUserShare 客户分享
     * @return 客户分享
     */
    @Override
    public List<WebUserShare> selectWebUserShareList(WebUserShare webUserShare)
    {
        return webUserShareMapper.selectWebUserShareList(webUserShare);
    }

    /**
     * 新增客户分享
     * 
     * @param webUserShare 客户分享
     * @return 结果
     */
    @Override
    public int insertWebUserShare(WebUserShare webUserShare)
    {
        webUserShare.setCreateTime(DateUtils.getNowDate());
        return webUserShareMapper.insertWebUserShare(webUserShare);
    }

    /**
     * 修改客户分享
     * 
     * @param webUserShare 客户分享
     * @return 结果
     */
    @Override
    public boolean updateWebUserShare(WebUserShare webUserShare)
    {
        //webUserShare.setUpdateTime(DateUtils.getNowDate());
        //return webUserShareMapper.updateWebUserShare(webUserShare);
        return this.saveOrUpdate(webUserShare);
    }

    /**
     * 删除客户分享对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public boolean deleteWebUserShareByIds(String ids)
    {
        //return webUserShareMapper.deleteWebUserShareByIds(Convert.toStrArray(ids));
        return this.removeByIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除客户分享信息
     * 
     * @param id 客户分享ID
     * @return 结果
     */
    @Override
    public boolean deleteWebUserShareById(Long id)
    {
        //return webUserShareMapper.deleteWebUserShareById(id);
        return this.removeById(id);
    }
}
